/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package comparators;

import interfaces.CompanyAdquiredProfileCapable;
import interfaces.SearchCapable;
import util.filter.Predicate;

/**
 *
 * @author damianfernandez
 * @param <T>
 * @param <S>
 */
public class CompanyAdquiredProfileCapableComparator<T extends CompanyAdquiredProfileCapable, S extends SearchCapable & Predicate<T>> extends CandidateCapableSearchCapableComparator<T,S> {

    public CompanyAdquiredProfileCapableComparator(S predicate) {
        super(predicate);
    }
    
    @Override
    public int compare(T companyAdquiredProfileCapable1,T companyAdquiredProfileCapable2){
        if(getPredicate().getSearch().getRequerimentsOR().isEmpty() && getPredicate().getSearch().getKeywords()==null){
            return companyAdquiredProfileCapable1.getCompanyAdquiredProfile().compareTo(companyAdquiredProfileCapable2.getCompanyAdquiredProfile());
        }
        else{
            return super.compare(companyAdquiredProfileCapable1, companyAdquiredProfileCapable2);
        }        
    }
    
}
